#------------------------------------------------------------------------------
# Makefile
# 	Makefile for the wifi module 
# Author: Roel Postelmans
#------------------------------------------------------------------------------
CC = g++ 
CFLAGS  = -g -Wall
LIBS = -pthread 
EXTRA=-std=c++0x  -Wl,--no-as-needed 

all: robocan

debug: CFLAGS += -DDEBUG 
debug: robocan_debug

robocan_debug: Buffer.o Server.o Robot.o Controller.o CanBotLL.o Serial.o
	$(CC) $(CFLAGS) -o robocan Buffer.o Server.o Controller.o Robot.o CanBotLL.o Serial.o $(LIBS) $(EXTRA)

robocan: Buffer.o Server.o Robot.o Controller.o
	$(CC) $(CFLAGS) -o robocan Buffer.o Server.o $(LIBS) $(EXTRA)

Buffer.o:  ./wifi/Buffer.cpp ./wifi/buffer.h ./wifi/package.h ./wifi/server.h
	$(CC) $(CFLAGS)  -c ./wifi/Buffer.cpp $(LIBS) $(EXTRA)

Server.o:  ./wifi/Server.cpp ./wifi/server.h ./wifi/buffer.h ./wifi/package.h 
	$(CC) $(CFLAGS) $(LIBS) -c ./wifi/Server.cpp  $(LIBS) $(EXTRA)


Robot.o:  highlevel/Robot.cpp highlevel/Robot.h ./wifi/server.h ./wifi/buffer.h ./wifi/package.h 
	$(CC) $(CFLAGS) $(LIBS) -c highlevel/Robot.cpp  $(LIBS) $(EXTRA)

Controller.o:  highlevel/Controller.cpp highlevel/Robot.h ./wifi/server.h ./wifi/buffer.h ./wifi/package.h 
	$(CC) $(CFLAGS) $(LIBS) -c highlevel/Controller.cpp  $(LIBS) $(EXTRA)
CanBotLL.o:  lowlevel/CanBotLL.cpp lowlevel/CanBotLL.h lowlevel/Serial.h
	$(CC) $(CFLAGS) $(LIBS) -c lowlevel/CanBotLL.cpp  $(LIBS) $(EXTRA)
Serial.o:  lowlevel/Serial.cpp lowlevel/CanBotLL.h lowlevel/Serial.h
	$(CC) $(CFLAGS) $(LIBS) -c lowlevel/Serial.cpp  $(LIBS) $(EXTRA)

clean: 
	$(RM) robocan *.o *~
